package cn.java76.spring1.printer;

/**
 * @author oldliu
 * @since 1.0
 */
public class Printer {
    private String brand;//品牌
    private int price;//价格
    private Ink ink;
    private Paper paper;//纸张和墨水的接口
    public Printer(){

    }

    public Printer(String brand, int price) {
        this.brand = brand;
        this.price = price;
        System.out.println("调用两个参数的构造方法！");
    }

    public void doInit(){
        //new 后，set结束了。。
        System.out.println("打印机初始化完成！");
    }
    public void xiaohui(){
        System.out.println("打印机销毁了");
    }
    public void print(String s){
        System.out.println("这个打印机的牌子是"+brand+",价格是"+price+"元");
        System.out.println("使用的墨水是"+ink.getColor());
        paper.print(s);//打印
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public void setInk(Ink ink) {
        this.ink = ink;
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
        System.out.println("设置纸张结束");
    }
}
